﻿'use strict';
eventsApp.factory('eventData', function ($resource,$q) {
    return {
        event: {
            imageurl: '/EventReg/img/logo1.png',
            name: 'Angular Boot Camp',
            date: '1/1/2013',
            time: '10.30pm',
            location: {
                address: 'no 6 agege street',
                city: 'ibadan',
                state: 'oyo'
            },
            session: [
                {
                    "name": "introductory Directives Masterclass",
                    "creatorName": "Bob Smith",
                    "duration": 1,
                    "level": "Advanced",
                    "abstract": "In this session you will learn the ins and outs of directives!",
                    "upVoteCount": 0
                },
        {
            "name": " Scopes for fun and profit",
            "creatorName": "John Doe",
            "duration": 3,
            "level": "Introductory",
            "abstract": "This session will take a closer look at scopes.  Learn what they do, how they do it, and how to get them to do it for you.",
            "upVoteCount": 0
        },
                    {
                        "name": "Well Behaved Controllers",
                        "creatorName": "Jane Doe",
                        "duration": 2,
                        "level": "Intermediate",
                        "abstract": "Controllers are the beginning of everything Angular does.  Learn how to craft controllers that will win the respect of your friends and neighbors.",
                        "upVoteCount": 0
                    }

            ]
        },
        getPatient: function () { 
            var deferred = $q.defer();
            $resource('http://localhost:11371/api/patient/:id', {id:'@id'})
            .get({ id:'555383cc-6154-4a21-b2c2-0e2239c2540e' },
            function (patientData) {
                deferred.resolve(patientData);
            },
            function (response) {
                deferred.rejected(response);

            });





            //$http({
            //    method: 'GET',
            //    url: 'http://localhost:11371/api/patient'
            //})
            //.success(function (data, status, header, config) {
            //    $log.info(data, status, header(), config);
            //    deferred.resolve(data);
            //})
            //.error(function (data, status, header, config) {
            //    deferred.reject(status);
            //});
            return deferred.promise;
    }


    }
});